home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW Related / MPW Script Tips 1.1.1 / Sample Scripts / AddDeleteMenu < prev    next >
Encoding:
Text File  |  1991-08-16  |  1.7 KB  |  34 lines  |  [TEXT/MPS ]

  1. #----------------------------------------------------------------------------------------------------------------------------------------------------
  2. #    AddDeleteMenu
  3. #    MPW Shell Script
  4. #    Written by Gina Cherry • August 16, 1991
  5. #    Copyright:    © 1991 by Apple Computer, Inc., all rights reserved.
  6. #
  7. # Usage:
  8. # AddDeleteMenu
  9. #
  10. #    Function: 
  11. #    AddDeleteMenu adds the menu item Delete to the Command menu.  Delete displays a standard file 
  12. #    dialog box with a delete button.  The user chooses a file to be deleted, and Delete deletes the
  13. #    file.  Delete does not ask for confirmation before deleting the file.
  14. #----------------------------------------------------------------------------------------------------------------------------------------------------                                                                
  15.                                                                                 
  16. # Add item Delete to Commands menu.  When invoked, Delete will execute the following commands:
  17. #    Display a standard file dialog box with a delete button.  The dialog will contain the message 
  18. #    "Select a file to delete."  The file dialog will return 0 status even if cancel is selected by the user.  
  19. #    Set File to the name of the File chosen from the file dialog.  If Cancel is chosen, File will be 
  20. # set to the null string.  If Cancel is not chosen, Delete deletes the file File.
  21.  
  22. # Note: the ∂ (option d) character is used to terminate each of the following lines because AddMenu
  23. #    expects to find all the commands on one line.
  24.  
  25.     AddMenu Commands 'Delete File/-'                                                                    ∂
  26.                                                                                                                                 ∂
  27.             'Set File "`GetFileName -m "        Select a file to delete" -b Delete -s`";    ∂
  28.             If {File} != "";                                                                                            ∂
  29.                 Delete {File};                                                                                            ∂
  30.             End'                                                                                                             
  31.  
  32.  
  33.  
  34.